<%@ page import="com.oval.util.JspHelper" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ page language="java" %>
<%@ page import="java.util.*" %>

<%
   String action = (String)request.getParameter("todo");
   String schema = (String)request.getParameter("table");
   if(action != null && schema != null && action.equals("enable"))
   {
     com.oval.foundation.bo.OvalEAIAPI.eai_disableSchema.remove(schema);
   }
   if(action != null && schema != null && action.equals("disable"))
   {
     com.oval.foundation.bo.OvalEAIAPI.eai_disableSchema.put(schema , "aaa");
   }
   HashMap disableMap = com.oval.foundation.bo.OvalEAIAPI.eai_disableSchema;
   boolean enable = com.oval.foundation.bo.OvalEAIAPI.eai_enable;
%>
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#999999">
  <tr> 
    <td class="td_title_bg">
        VTable Name
    </td>
    <td class="td_title_bg">
        Primary Table Name
    </td>
    <td class="td_title_bg">
        Column Num
    </td>
    <td class="td_title_bg">
        From Table Num
    </td>
    <td class="td_title_bg">
        Mapping Num
    </td>
    <td class="td_title_bg">
        QL Num
    </td>
    <td class="td_title_bg">
        Is Have Cascade Delete
    </td>
    <% if(enable)
      { %>
    <td class="td_title_bg">
        Disable/Enable EAI
    </td>
    <% } %>
  </tr>
  <% 
     Iterator it = com.oval.foundation.container.VTableContainer.getVTableMetas();
     String searchParam = (String)request.getParameter("searchParam");
     while(it.hasNext())
     {
       com.oval.foundation.metadata.engine.OvalVTable ent = (com.oval.foundation.metadata.engine.OvalVTable)it.next(); 
       if(searchParam != null && (ent.getTableName().indexOf(searchParam.trim()) == -1))
         continue;
       String name = ent.getTableName();
       %>
       
     <tr class="td_bg_row"> 
       <td class="td_center">
         <div align="left">
         <a href="javascript:popupTree('ShowVTable.jsp?name=<%=JspHelper.filterNull( name )%>')"><%=JspHelper.filterNull( ent.getTableName() )%></a>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( ent.m_strPrimaryTable )%>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( ent.getColumnLength() )%>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( ent.getFromTableLength() )%>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( ent.getMappingLength() )%>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( ent.getOvalQLLength() )%>
         </div>
       </td>
       <td class="td_center">
         <div align="left">
         <%=JspHelper.filterNull( (new Boolean(ent.isHaveCasecadeDelete())).toString() )%>
         </div>
       </td>
       <% if(enable)
       {
         if(disableMap.get(name) == null)
         { %>
       <td class="td_center">
         <a href="consoleContent.jsp?nocache=&contentType=VirtualTable&table=<%=JspHelper.filterNull( name )%>&todo=disable">
           <div align="left">
             <img src="images/chinese/bt-disable.gif" border="0" width="57" height="18">
           </div>
         </a>
       </td>
       <% }
          else
          { %>
       <td class="td_center">
         <a href="consoleContent.jsp?nocache=&contentType=VirtualTable&table=<%=JspHelper.filterNull( name )%>&todo=enable">
           <div align="left">
             <img src="images/chinese/bt-enable.gif" border="0" width="57" height="18">
           </div>
         </a>
       </td>
       <% }} %>
     </tr>
  <% } %>
  </table>
</tr>
</table>


